package com.edu.zql;

import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializeFilter;
import com.alibaba.fastjson.serializer.SerializerFeature;

/**
 * Created by User on 2017/10/18.
 */
public class Json {

    public static void main(String[] args) {

        Person mary = new Person("Mary", null, 0);


        String s = JSONObject.toJSONString(mary);

        System.out.println(s);


    }

    static class Person {
        String name;
        Integer age;
        int sex;

        public Person(String name, Integer age, int sex) {
            this.name = name;
            this.age = age;
            this.sex = sex;
        }

        public String getName() {
            return name;
        }

        public Person setName(String name) {
            this.name = name;
            return this;
        }

        public Integer getAge() {
            return age;
        }

        public Person setAge(Integer age) {
            this.age = age;
            return this;
        }

        public int getSex() {
            return sex;
        }

        public Person setSex(int sex) {
            this.sex = sex;
            return this;
        }
    }

}
